package com.farmneighbor.topTest;

import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Stack;

public class SmallTopStack<E> extends PriorityQueue<E> {
    int column;

  public SmallTopStack(Comparator<? super E>comparator,int column) {
      super(comparator);
      this.column = column;
  }

    @Override
    public boolean offer(E e) {

        boolean flag = super.offer(e);
        if(this.size()>column){
           this.poll();
       }
       return flag;
    }
}
